package com.bank.domain;

import java.io.Serializable;
import java.sql.Timestamp;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.Valid;
import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.NotEmpty;

@Entity
@Table(name = "transactions")
public class Transaction implements Serializable {

	private static final long serialVersionUID = 5924361831551833717L;
	private TransactionStatuss TransactionStatuss;
	@Id
	@Column(name = "TRANSACTION_ID")
	@GeneratedValue
	private Integer transactionId;
	
	@Column(name = "CUSTOMER_ID")
	private Integer customerId;

	@Column(name = "TRANSACTION_HASH")
	private String transactionHash;
	

	@Column(name = "TRANSACTION_AMOUNT")
	private double transactionAmount;
	
	@Pattern(regexp="^LV11VIAB[0-9]{13}$", message = "Reciever account is in wrong format")
	@Column(name = "ACCOUNT_TO")
	private String accountTo;
	@Pattern(regexp="^LV11VIAB[0-9]{13}$", message = "Account is in wrong format")
	@Column(name = "ACCOUNT_FROM")
	private String accountFrom;
	
	@Column(name = "TRANSACTION_DETAILS")
	private String transactionDetails;	
	
	@Column(name = "TRANSACTION_DATE")
	private Timestamp transactionDate;
	
	@Column(name = "TRANSACTION_STATUS_ID")
	private Integer transactionStatusId;

	@ManyToOne(cascade = CascadeType.ALL)
	public TransactionStatuss getStatussName() {
		return TransactionStatuss;
	}
	
	public void setStatussName(TransactionStatuss TransactionStatuss) {
		this.TransactionStatuss = TransactionStatuss;
	}
	
	
	/**
	 * @return the transactionId
	 */
	public Integer getTransactionId() {
		return transactionId;
	}

	/**
	 * @param transactionId the transactionId to set
	 */
	public void setTransactionId(Integer transactionId) {
		this.transactionId = transactionId;
	}

	/**
	 * @return the customerId
	 */
	public Integer getCustomerId() {
		return customerId;
	}

	/**
	 * @param customerId the customerId to set
	 */
	public void setCustomerId(Integer customerId) {
		this.customerId = customerId;
	}

	/**
	 * @return the transactionHash
	 */
	public String getTransactionHash() {
		return transactionHash;
	}

	/**
	 * @param transactionHash the transactionHash to set
	 */
	public void setTransactionHash(String transactionHash) {
		this.transactionHash = transactionHash;
	}

	/**
	 * @return the transactionAmount
	 */
	public double getTransactionAmount() {
		return transactionAmount;
	}

	/**
	 * @param transactionAmount the transactionAmount to set
	 */
	public void setTransactionAmount(double transactionAmount) {
		this.transactionAmount = transactionAmount;
	}

	/**
	 * @return the accountTo
	 */
	public String getAccountTo() {
		return accountTo;
	}

	/**
	 * @param accountTo the accountTo to set
	 */
	public void setAccountTo(String accountTo) {
		this.accountTo = accountTo;
	}

	/**
	 * @return the accountFrom
	 */
	public String getAccountFrom() {
		return accountFrom;
	}

	/**
	 * @param accountFrom the accountFrom to set
	 */
	public void setAccountFrom(String accountFrom) {
		this.accountFrom = accountFrom;
	}

	/**
	 * @return the transactionDetails
	 */
	public String getTransactionDetails() {
		return transactionDetails;
	}

	/**
	 * @param transactionDetails the transactionDetails to set
	 */
	public void setTransactionDetails(String transactionDetails) {
		this.transactionDetails = transactionDetails;
	}

	/**
	 * @return the transactionDate
	 */
	public Timestamp getTransactionDate() {
		return transactionDate;
	}

	/**
	 * @param transactionDate the transactionDate to set
	 */
	public void setTransactionDate(Timestamp transactionDate) {
		this.transactionDate = transactionDate;
	}

	/**
	 * @return the transactionStatusId
	 */
	public Integer getTransactionStatusId() {
		return transactionStatusId;
	}

	/**
	 * @param transactionStatusId the transactionStatusId to set
	 */
	public void setTransactionStatusId(Integer transactionStatusId) {
		this.transactionStatusId = transactionStatusId;
	}

	/**
	 * @return the serialversionuid
	 */
	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	
	

	
	
}
